package org.example.demosr3.dao;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.example.demosr3.entity.User;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface UserDao {

    @Select("select * from users where username = #{username} and password = #{password}")
    User getUserByName(@Param("username") String username,String password);


    @Select("select count(1) from users where username=#{username}")
     int findUserByName(User user);

    @Insert("insert into users(username,password) values (#{username},#{password})")
     int createUser(User user);

}
